using NUnit.Framework;
using Tycho.Parser.Peg;

namespace Tycho.Parser.Tests.Peg {
    [TestFixture]
    public class WhitespaceProductionSpecification {
        [Test]
        public void ShouldParseWhitespace () {
            Assert.AreEqual(3, ParseWhitespace ("   stuff", 0));
            Assert.AreEqual(3, ParseWhitespace ("   stuff", 2));
            Assert.AreEqual(0, ParseWhitespace ("stuff", 0));
            Assert.AreEqual(3, ParseWhitespace ("   stuff", 3));
        }

        private static int ParseWhitespace (string source, int startIndex) {
            return Whitespace.SkipWhitespace (source.ToCharArray(), startIndex);
        }
    }
}